Fix typo that resulted in unnecessarily short waypoint names. Confirmed
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 15 Mar 2004 01:03:53 +0000 (01:03 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 15 Mar 2004 01:03:53 +0000 (01:03 +0000)
"good" by user.

gpsbabel/garmin.c

index e8b32bdf9a2a10fe61827378a04aba2e1632d88e..adc891c2cbd9675b25acef40620d7b30441b9fd3 100644 (file)
@@ -394,13 +394,17 @@ waypoint_write(void)
                ident = global_opts.synthesize_shortnames ? 
                                mkshort(mkshort_handle, src) : 
                                wpt->shortname;
-               strncpy(way[i]->ident,  ident, sizeof(way[i]->ident));
+               /* Should not be a strcpy as 'ident' isn't really a C string,
+                * but rather a garmin "fixed length" buffer that's padded
+                * to the end with spaces.  So this is NOT (strlen+1).
+                */
+               memcpy(way[i]->ident, ident, strlen(ident));
                if (global_opts.synthesize_shortnames) { 
                        xfree(ident);
                }
                way[i]->ident[sizeof(way[i]->ident)-1] = 0;
                if (src && strlen(src)) {
-                       strncpy(way[i]->cmnt, src, sizeof(way[i]->cmnt));
+                       memcpy(way[i]->cmnt, src, strlen(src));
                }
                way[i]->lon = wpt->longitude;
                way[i]->lat = wpt->latitude;